package Demo;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User：Lenovo
 * Date:2025-01-07
 * Time:14:00
 */
public class demo {
    public boolean contains(int key){
        ListNode cur=head;
        while(cur!=null){
            if (key == cur.val) {
                return true;
            }
            cur=cur.next;
        }
        return false;
    }
    public void addLast(int date){
        ListNode node=new ListNode(date);
        if(head==null){
            head=node;
            return;
        }
        ListNode cur=head;
        while(head.next!=null){
          cur=cur.next;
        }
        cur.next=node;
    }
    private ListNode findIndex(int index){
        ListNode cur=head;
        int count=0;
        while(count!=index-1){
            cur=cur.next;
            count++;
        }
        return cur;
    }
    public static void main(String[] args) {
        System.out.println("hello");
    }
}
